<template>
  <div class="new_modal_max">
    <el-dialog
      style="margin-top: 35vh;"
      :width="width"
      :modal="modal"
      :visible.sync="addModal"
    >
      <div slot="title">
        {{title}}
      </div>
      <slot></slot>
    </el-dialog>
  </div>
</template>
<script>
export default {
  components: {
  },
  props: {
    // name
    title: {
      type: String | Boolean | Number,
      default: "",
    },
    // width
    width: {
      type: String,
      default: "400px",
    },
    // show 弹出
    showModal: {
      type: Boolean,
      default: false,
    },
    // 确认 loading
    loading: {
      type: Boolean,
      default: false,
    },
    // 遮罩
    modal: {
      type: Boolean,
      default: true,
    },
  },
  watch: {
    showModal(val) {
      this.addModal = val;
    },
    addModal(val) {
      this.$emit("update:showModal", val);
    },
  },
  data() {
    return {
      addModal: false,
    };
  },
  methods: {
    // 取消按钮
    cancel() {
      this.addModal = false;
      this.$emit("close");
    },
  },
};
</script>
<style lang="scss">
.new_modal_max {
  .el-dialog {
    border-radius: 5px;
  }
  .el-dialog__body {
    padding: 15px 20px 25px;
  }
}
</style>
